﻿using System;
using Hourglass.Qrobot.Http;

namespace Hourglass.Qrobot.States
{
    /// <summary>
    /// Watting for get QRCode and display
    /// </summary>
    public class WattingForGetQRCodeState : QQState
    {
        private readonly Random _random;

        public WattingForGetQRCodeState()
        {
            this._random = new Random();
        }

        public override void Handler(QQContext context)
        {
            var para = context.ToLoginQrCodeRequest();
            var image = DataProvider.GetLoginQRCode(para);
            context.Displayer.DisplayQRCode(image);
            context.Displayer.DisplayStatus("请扫描二维码登录");
            context.State = new WattingForScanQRCodeState();
        }
    }
}
